<template>
  <div class="wrapper">
    <swiper :options="swiperOption">
      <!-- slides -->
      <swiper-slide v-for="item of list" :key="item.id" >        
        <div>
         <img class="swiper-img" :src="item.imgUrl">
        </div>
      </swiper-slide>
     
      <!-- Optional controls -->
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>
<script>
export default {
  name:'HomeSwiper',
  props: {
    list:Array
  },
  data () {    
    return {
      swiperOption: {
        pagination: ".swiper-pagination",
        loop:true    
      },
      swiperList:[{
        id:'0001',
        imgUrl:'../../../static/img/home/img1.jpg'
      },{
        id:'0002',
        imgUrl:'../../../static/img/home/img2.jpg'
      },{
        id:'0003',
        imgUrl:'../../../static/img/home/img3.jpg'
      },{
        id:'0004',
        imgUrl:'../../../static/img/home/img4.jpg'
      },{
        id:'0005',
        imgUrl:'../../../static/img/home/img5.jpg'
      }
      ]
    };
  },
  updated (){
    console.log("updatedlist:",this.list)
  }
};
</script>
<style lang="stylus" scoped>
// Vue中的scoped及穿透方法
.wrapper >>> .swiper-pagination-bullet-active {
  background: #fff;
}

.wrapper {
  overflow: hidden;
  width: 100%;
  height:0;
  padding-bottom 26.66%;
  background: #eee;

  .swiper-img {
    width: 100%;
  }
}
</style>


